package router

import (
	"k8s-admin/controller/system"
	"k8s-admin/controller/system/casbin"
	"k8s-admin/middleware"

	"github.com/gin-gonic/gin"
)

func Users(r *gin.Engine) {
	users := r.Group("/user")
	users.Use(middleware.ChecKToken(), middleware.CasbinMiddle())
	{
		users.GET("userList", system.UserList)
		users.GET("userRole", system.UserRole)
		users.POST("userCreate", system.UserAdd)
		users.POST("userUpdate", system.UserUpdate)
		users.DELETE("userDelete", system.UserDelete)
		users.POST("userDeleteRole", system.DeleteUserRole)
		users.POST("casbincreate", casbin.CreateRule)
		users.GET("casbinList", casbin.RuleList)
		users.POST("rolecreate", casbin.CreateRoles)
		users.GET("roleroleList", casbin.RolesList)
		users.POST("setRolePolicy", casbin.SetRoleRule)
		users.POST("setUserRole", system.SetUserRole)
		users.POST("delRolePolicy", casbin.DeleteRule) // 删除角色权限
		users.DELETE("delRole", casbin.DeleteRole)     // 删除角色
	}
}
